﻿using OS.Common.Core;
using OS.Common.Enums;

namespace OS.Common.Extention
{
    /// <summary>
    /// CustomResult扩展
    /// </summary>
    public static class CustomResultExtention
    {
        /// <summary>
        /// 是否是Success
        /// </summary>
        /// <param name="baseResult">基类返回结果实体</param>
        /// <returns></returns>
        public static bool IsSuccess(this CustomResult baseResult)
        {
            return baseResult.Code == (int) ResultType.Success;
        }

        /// <summary>
        /// 是否是对应的结果类型
        /// </summary>
        /// <param name="baseResult">基类返回结果实体</param>
        /// <param name="resultType">返回结果类型</param>
        /// <returns></returns>
        public static bool IsResultType(this CustomResult baseResult, ResultType resultType)
        {
            return baseResult.Code == (int) resultType;
        }
    }
}